<?php
/**
 * +--------------------------------------------------------+
 * @Created by PhpStorm.
 * @Category admin.php
 * @Depiction:
 * Author: hwy
 * Date: 2020/5/28  16:06
 * +--------------------------------------------------------+
 */

Route::any('login', 'Admin\LoginController@login')->name('login');
Route::post('login_handle', 'Admin\LoginController@loginHandle')->name('login.handle');
// Route::get('logout', function () {
//     Auth::guard('admin')->logout();
//     return redirect('/login');
// });

Route::group(['prefix'=>'admin', 'namespace'=>'Admin', 'middleware'=>'auth.admin'], function () {
    Route::prefix('index')->group(function () {
        //后台首页
        Route::get('index', 'IndexController@index')->name('admin.index.index');
        Route::get('main', 'IndexController@main')->name('admin.index.main');
    });

    Route::prefix('article')->group(function (){
        Route::get('index','ArticleController@index')->name('admin.article.index');
        Route::get('get_list','ArticleController@getList')->name('admin.article.get_list');
        Route::get('show/{$id}','ArticleController@show')->name('admin.article.show');
        Route::get('create','ArticleController@create')->name('admin.article.create');
        Route::post('store','ArticleController@store')->name('admin.article.store');
        Route::get('edit/{id}','ArticleController@edit')->name('admin.article.edit');
        Route::post('update/{id}','ArticleController@update')->name('admin.article.update');
        Route::delete('destroy','ArticleController@destroy')->name('admin.article.destroy');
    });

    Route::prefix('tag')->group(function (){
        Route::get('index','TagController@index')->name('admin.tag.index');
        Route::get('get_list','TagController@getList')->name('admin.tag.get_list');
        Route::get('show/{$id}','TagController@show')->name('admin.tag.show');
        Route::get('create','TagController@create')->name('admin.tag.create');
        Route::post('store','TagController@store')->name('admin.tag.store');
        Route::get('edit/{id}','TagController@edit')->name('admin.tag.edit');
        Route::post('update/{id}','TagController@update')->name('admin.tag.update');
        Route::delete('destroy','TagController@destroy')->name('admin.tag.destroy');
    });

    Route::prefix('scheduling')->group(function (){
        Route::get('index','SchedulingController@index')->name('admin.scheduling.index');
        Route::get('get_list','SchedulingController@getList')->name('admin.scheduling.get_list');
        Route::post('scheduling_run','SchedulingController@runEvent')->name('admin.scheduling.scheduling_run');
    });


//    Route::prefix('variable')->group(function (){
//        Route::get('index','VariableController@index')->name('admin.variable.index');
//        Route::get('get_list','VariableController@getList')->name('admin.variable.get_list');
//        Route::get('show','VariableController@show')->name('admin.variable.show');
//        Route::get('create','VariableController@create')->name('admin.variable.create');
//        Route::post('store','VariableController@store')->name('admin.variable.store');
//        Route::get('edit/{id}','VariableController@edit')->name('admin.variable.edit');
//        Route::post('update/{id}','VariableController@update')->name('admin.variable.update');
//        Route::delete('destroy/{id}','VariableController@destroy')->name('admin.variable.destroy');
//        Route::delete('destroy_batch','VariableController@destroy')->name('admin.variable.destroy');
//    });

    Route::prefix('category')->group(function (){
        Route::get('index','CategoryController@index')->name('admin.category.index');
        Route::get('get_list','CategoryController@getList')->name('admin.category.get_list');
        Route::get('show','CategoryController@show')->name('admin.category.show');
        Route::get('create','CategoryController@create')->name('admin.category.create');
        Route::post('store','CategoryController@store')->name('admin.category.store');
        Route::get('edit/{id}','CategoryController@edit')->name('admin.category.edit');
        Route::post('update/{id}','CategoryController@update')->name('admin.category.update');
        Route::delete('destroy/{id}','CategoryController@destroy')->name('admin.category.destroy');
    });



    ///////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////

    Route::prefix('stock')->group(function (){
        Route::get('index','StockController@index')->name('admin.stock.index');
        Route::get('get_list','StockController@getList')->name('admin.stock.get_list');
        Route::get('show','StockController@show')->name('admin.stock.show');
        Route::get('create','StockController@create')->name('admin.stock.create');
        Route::post('store','StockController@store')->name('admin.stock.store');
        Route::get('edit/{id}','StockController@edit')->name('admin.stock.edit');
        Route::post('update/{id}','StockController@update')->name('admin.stock.update');
        Route::delete('destroy','StockController@destroy')->name('admin.stock.destroy');
        Route::get('rest_cost','StockController@restCost')->name('admin.stock.rest_cost');
        Route::post('set_attention','StockController@setAttention')->name('admin.stock.set_attention');
        Route::post('set_warm','StockController@setWarm')->name('admin.stock.set_warm');
        Route::post('is_init','StockController@isInit')->name('admin.stock.is_init');
        Route::get('init_stock_list','StockController@initStockList')->name('admin.stock.init_stock_list');
    });




    //栏目管理


    Route::prefix('article_stock')->group(function (){
        Route::get('index','ArticleStockController@index')->name('admin.article_stock.index');
        Route::get('get_list','ArticleStockController@getList')->name('admin.article_stock.get_list');
        Route::get('show','ArticleStockController@show')->name('admin.article_stock.show');
        Route::get('create','ArticleStockController@create')->name('admin.article_stock.create');
        Route::post('store','ArticleStockController@store')->name('admin.article_stock.store');
        Route::get('edit/{id}','ArticleStockController@edit')->name('admin.article_stock.edit');
        Route::post('update/{id}','ArticleStockController@update')->name('admin.article_stock.update');
        Route::delete('destroy/{id}','ArticleStockController@destroy')->name('admin.article_stock.destroy');
    });


    Route::prefix('setting_config_tab')->group(function (){
        Route::get('index','SettingConfigTabController@index')->name('admin.setting_config_tab.index');
        Route::get('get_list','SettingConfigTabController@getList')->name('admin.setting_config_tab.get_list');
        Route::get('show','SettingConfigTabController@show')->name('admin.setting_config_tab.show');
        Route::get('create','SettingConfigTabController@create')->name('admin.setting_config_tab.create');
        Route::post('store','SettingConfigTabController@store')->name('admin.setting_config_tab.store');
        Route::get('edit/{id}','SettingConfigTabController@edit')->name('admin.setting_config_tab.edit');
        Route::post('update/{id}','SettingConfigTabController@update')->name('admin.setting_config_tab.update');
        Route::delete('destroy/{id}','SettingConfigTabController@destroy')->name('admin.setting_config_tab.destroy');
        Route::post('setStatus/{id}','SettingConfigTabController@setStatus')->name('admin.setting_config_tab.setStatus');
    });

    Route::prefix('setting_config')->group(function (){
        Route::get('index','SettingConfigController@index')->name('admin.setting_config.index');
        Route::get('get_list','SettingConfigController@getList')->name('admin.setting_config.get_list');
        Route::get('show','SettingConfigController@show')->name('admin.setting_config.show');
        Route::get('create','SettingConfigController@create')->name('admin.setting_config.create');
        Route::post('store','SettingConfigController@store')->name('admin.setting_config.store');
        Route::get('edit/{id}','SettingConfigController@edit')->name('admin.setting_config.edit');
        Route::post('update/{id}','SettingConfigController@update')->name('admin.setting_config.update');
        Route::delete('destroy/{id}','SettingConfigController@destroy')->name('admin.setting_config.destroy');
        Route::post('setStatus/{id}','SettingConfigController@setStatus')->name('admin.setting_config.setStatus');
        Route::get('select_type','SettingConfigController@selectType')->name('admin.setting_config.select_type');
    });


    Route::prefix('setting_config_page')->group(function (){
        Route::get('index','SettingConfigPageController@index')->name('admin.setting_config_page.index');
        Route::post('update','SettingConfigPageController@update')->name('admin.setting_config_page.update');
    });

    Route::prefix('file')->group(function (){
        Route::get('get_file_list','FileController@index')->name('admin.file.get_file_list');
        Route::post('upload','FileController@upload')->name('admin.file.upload');
        Route::post('upload_log','FileController@upload_log')->name('admin.file.upload_log');
    });

    Route::prefix('file_category')->group(function (){
        Route::get('get_file_category','FileCategoryController@index')->name('admin.file_category.get_file_category');
        Route::post('upload_log','FileController@upload_log')->name('admin.file.upload_log');
    });


    //角色管理
    Route::prefix('role')->group(function (){
        Route::get('index','RoleController@index')->name('admin.role.index');
        Route::get('get_list','RoleController@getList')->name('admin.role.get_list');
        Route::get('show','RoleController@show')->name('admin.role.show');
        Route::get('create','RoleController@create')->name('admin.role.create');
        Route::post('store','RoleController@store')->name('admin.role.store');
        Route::get('edit/{id}','RoleController@edit')->name('admin.role.edit');
        Route::post('update/{id}','RoleController@update')->name('admin.role.update');
        Route::delete('destroy','RoleController@destroy')->name('admin.role.destroy');
    });
    //权限相关
    // Route::prefix('permission')->group(function (){
    //     Route::get('getPermission','PermissionController@getPermission')->name('admin.permission.getPermission');
    // });

    //管理员管理
    Route::prefix('admin')->group(function (){
        Route::get('index','AdminController@index')->name('admin.admin.index');
        Route::get('get_list','AdminController@getList')->name('admin.admin.get_list');
        Route::get('show','AdminController@show')->name('admin.admin.show');
        Route::get('create','AdminController@create')->name('admin.admin.create');
        Route::post('store','AdminController@store')->name('admin.admin.store');
        Route::get('edit/{id}','AdminController@edit')->name('admin.admin.edit');
        Route::post('update/{id}','AdminController@update')->name('admin.admin.update');
        Route::post('update_password','AdminController@update_password')->name('admin.admin.update_password');
        Route::delete('destroy','AdminController@destroy')->name('admin.admin.destroy');
    });


    //扩展包学习
    Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');


});
